//
//  JGSearchBar.m
//  CustomTabBar
//
//  Created by JJetGu on 15/7/2.
//  Copyright (c) 2015年 JJetGu. All rights reserved.
//

#import "JGSearchBar.h"

@implementation JGSearchBar

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.font = [UIFont systemFontOfSize:15];
        self.placeholder = @"请输入搜索条件";
        self.background = [UIImage imageNamed:@"searchbar_textfield_background"];
        self.clearButtonMode = UITextFieldViewModeWhileEditing;
        self.returnKeyType = UIReturnKeySearch;
        
        //textFiled左边的View
        UIImageView *searchIcon = [[UIImageView alloc] init];
        searchIcon.image = [UIImage imageNamed:@"searchbar_textfield_search_icon"];
        searchIcon.width = 30;
        searchIcon.height = 30;
        searchIcon.contentMode = UIViewContentModeCenter;
        self.leftView = searchIcon;
        //这样子才能显示出来
        self.leftViewMode = UITextFieldViewModeAlways;
    }
    
    return self;
}

+(instancetype)searchBar
{
    return [[self alloc] init];
}






@end
